﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using PNProject.EF;
using PNProject.Core;

namespace PNProject.Core.Converter
{
    public class SupportConverter
    {
        public static Support ToSupport(SupportModel sup)
        {
            Support obj = new Support();
            obj.Name = sup.Name;
            obj.Nick = sup.Nick;
            obj.Description = sup.Description;
            if (sup.Type == "yahoo")
                obj.Type = true;
            else
                obj.Type = false;
            return obj;
        }

        public static SupportModel SupportTo(Support sup)
        {
            SupportModel obj = new SupportModel();
            obj.Name = sup.Name;
            obj.Nick = sup.Nick;
            obj.Description = sup.Description;
            obj.ID = sup.SupportID.ToString();
            obj.Type = sup.Type.HasValue ? sup.Type.Value.ToString() : "True";
            return obj;
        }
    }
}